const path = require('path');
const bodyParser = require('koa-bodyparser')
const nunjucks = require('koa-nunjucks-2')
const koaStatic = require('koa-static')
const simpleSend = require('./simple-send');

module.exports = (app) => {
    app.use(bodyParser());

    app.use(async (ctx,next)=>{
        ctx.cookies.set('fire-eye','leonchua')
        console.log('cookie: ' , ctx.cookies.get('fire-eye'))
        await next();
    })
    app.use(koaStatic(path.resolve(__dirname, "../public")) );
    app.use(nunjucks({
        ext: 'html',
        path: path.join(__dirname, '../views'),
        nunjucksConfig: {
        trimBlocks: true
        }
    }));
    app.use(simpleSend())

    

}  